import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { TaskStatus } from '../task-status.enum';
import { User } from '../../../system/user/entities/user.entity';
import { Exclude } from 'class-transformer';

@Entity()
export class Task {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  title: string;

  @Column()
  description: string;

  @Column()
  status: TaskStatus;
  @Column({
    type: 'int',
    comment: '删除标记 0-未删除 1-删除',
    name: 'is_delete',
    default: 0,
  })
  isDelete: number;

  @ManyToOne((type) => User, (user) => user.tasks, { eager: true })
  @Exclude({ toPlainOnly: true })
  user: User;
}
